<script setup lang="ts">
import updatePassword from "~/components/user/updatePassword.vue";
import UpdateEmailOrPhone from "~/components/user/updateEmailOrPhone.vue";

const updatePasswordShow = ref(0)

function updatePsd() {
  updatePasswordShow.value++;
}

const updateEmailShow = ref(0)

function updateEmailMsg() {
  updateEmailShow.value++;
}
</script>

<template>
  <div class="user-account-box">
    <div class="account-top-box">

    </div>
    <div class="account-content-box">
      <div class="content-title">
        账户信息
      </div>
      <div class="content-message">
        <div class="content-item">
          <div class="content-item-title">
            密 码
          </div>
          <div class="content-item-message">
<!--            {{ userInfoStore().loginUser.password }}-->
            ******
            <div class="content-button">
              <el-button @click="updatePsd">修改密码</el-button>
            </div>
          </div>
        </div>
        <div class="content-item">
          <div class="content-item-title">
            邮 箱
          </div>
          <div class="content-item-message">
            {{ userInfoStore().loginUser.email }}
            <div class="content-button">
              <el-button @click="updateEmailMsg">修改邮箱</el-button>
            </div>
          </div>
        </div>
        <div class="content-item">
          <div class="content-item-title">
            手 机
          </div>
          <div class="content-item-message">
            {{ userInfoStore().loginUser.phone }}
            <div class="content-button">
              <el-button disabled>修改手机</el-button>
            </div>
          </div>
        </div>
        <div class="content-item">
          <div class="content-item-title">
            Q Q
          </div>
          <div class="content-item-message">
            {{ userInfoStore().loginUser.qq }}
            <div class="content-button">
              <el-button disabled>修改QQ</el-button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="account-dialog-box">
      <div class="update-psd">
        <UpdateEmailOrPhone :show="updateEmailShow"/>
      </div>
      <div class="update-email">
        <updatePassword :show="updatePasswordShow"/>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.user-account-box {
  display: flex;
  flex-direction: column;

  .account-top-box {
    width: 100%;
    height: 15rem;
    display: flex;
    background-color: var(--item-bgc);

  }

  .account-content-box {
    margin-top: 1rem;
    background-color: var(--item-bgc);

    .content-title {
      padding: 1rem 2rem;
      font-size: 1.2rem;
      font-weight: bolder;
      border-bottom: solid .1rem var(--body-bgc);
    }

    .content-message {

      .content-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .5rem 2rem;
        margin: .5rem 0;

        .content-item-message {
          display: flex;
          align-items: center;

          .content-button {
            margin: 0 1rem;
          }
        }
      }
    }
  }
}
</style>